@import '../style/core/index';
@import '../style/themes/index';

$lv-input-tag-prefix-cls: 'lv-input-tag' !default;

$lv-input-tag-min-width: 0.99rem !default;
$lv-input-tag-padding: 0.03rem $padding-sm !default;
$lv-input-tag-padding-large: 0.07rem $padding-sm !default;
$lv-input-tag-space: $space-base * 2 !default;

$lv-input-tag-color: $text-color !default;
$lv-input-tag-border-color: $border-color-base !default;

.#{$lv-input-tag-prefix-cls} {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-width: $lv-input-tag-min-width;
  padding: $lv-input-tag-padding;
  color: $lv-input-tag-color;
  font-weight: $font-weight-regular;
  font-size: $font-size-base;
  line-height: $line-height-lg;
  background-color: $input-background;
  border-color: $lv-input-tag-border-color;
  border-style: $border-style-base;
  border-width: $border-width-base;
  border-radius: $border-radius-md;
  @include motion-input;

  &-large {
    padding: $lv-input-tag-padding-large;
    .lv-input-tag-clear {
      height: 0.38rem;
    }
  }

  &:not(.lv-input-tag-disabled):not(.lv-input-tag-focused):hover {
    border-color: $border-color-hover;
  }

  &:not(.lv-input-tag-disabled):hover {
    .lv-input-tag-clear {
      visibility: visible;
      opacity: 1;
    }
  }

  &-focused {
    border-color: $border-color-active;
  }

  &-disabled {
    background-color: $disabled-background;
    border-color: $border-color-disabled;
    cursor: not-allowed;
    .lv-input {
      background-color: transparent;
    }
  }

  &-inner {
    width: 100%;
  }

  &-input {
    flex: 1;
    min-width: $lv-input-tag-min-width;
    color: $lv-input-tag-color;
    font-weight: $font-weight-regular;
    font-size: $font-size-base;
    line-height: $line-height-lg;
    background-color: $input-background;
    border: none;
    outline: none;
  }

  &-clear {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    width: 0.32rem;
    height: 0.3rem;
    align-items: center;
    visibility: hidden;
    opacity: 0;

    @include motion-state;

    i {
      @include icon-size;
    }
  }

  .lv-input:not(textarea).lv-input-size-default {
    padding: 0;
  }

  .lv-tag-main {
    margin: -$margin-xs 0;
  }
}
